import matplotlib.pyplot as plt
import graph_tool.all as gt
g = gt.load_graph_from_csv("Datasets/soc-sign-bitcoinotc.csv.gz")
vtxs = 0
for v in g.vertices():
vtxs += 1
edgs = 0
for e in g.edges():
edgs += 1
vtxs, edgs
gt.graph_draw(g)
H = gt.vertex_hist(g, "out")
qtds, degs = H
plt.plot(qtds)
plt.hist(H);
gt.vertex_average(g,"out")
%timeit gt.distance_histogram(g)
DistH = gt.distance_histogram(g)
DistH
plt.plot(DistH[0]);
gt.label_components(g)
tree = gt.min_spanning_tree(g)
gt.graph_draw(g, edge_color=tree)
g.set_edge_filter(tree)
gt.graph_draw(g)
bv, be = gt.betweenness(g)
be.a /= be.a.max() / 5
gt.graph_draw(g, vertex_fill_color=bv, edge_pen_width=be)
astro-ph power dolphins
g = gt.collection.data["dolphins"]
gt.graph_draw(g)
g = gt.collection.data["power"]
gt.graph_draw(g)
g = gt.collection.data["astro-ph"]
gt.graph_draw(g)